package other;

import java.util.ArrayList;
import java.util.List;

// 求0-1区间且分母 <= n 的所有最简分数
public class Test03 {
    public static void main(String[] args) {

        System.out.println(test1(2));
    }


    public static List<String> test1(int n) {
        List<String> list = new ArrayList<>();
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j < i; j++) {
                int zi = j;
                int mu = i;
                while ((zi - mu) != 0) {
                    if (mu > zi) {
                        mu = mu - zi;
                    } else {
                        zi = zi - mu;
                    }

                }
                if (mu == 1) {
//                    String s = "\""+j + "/" + i+"\"";
                    String s = j + "/" + i;
                    list.add(s);
                }
            }
        }
        return list;
    }
}
